// -*-C++-*-
#ifndef __SOCKET_UNIX_H__
# define __SOCKET_UNIX_H__

# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <unistd.h>
# include <netdb.h>

# include "../ISocket.h"

class SocketImpl : public ISocket
{
public:
  SocketImpl();
  ~SocketImpl();

  SocketImpl(SocketImpl const & impl);
  SocketImpl& operator=(SocketImpl const & impl);

  virtual void open(int domain, int type);

  virtual void bind(int port, char *addr);
  virtual void listen(int backlog);
  virtual void accept(ISocket *);

  virtual void connect(int port, char *addr);

  virtual int send(const void *msg, size_t len);
  virtual int recv(void *buf, size_t len);

  virtual void close();
private:
  int _fd;
  int _domain;
  int _type;
  sockaddr_in sin;
  socklen_t len;
};

#endif // __SOCKET_UNIX_H__
